package com.itgaoshu.hospitalproject.service.impl;

import com.itgaoshu.hospitalproject.bean.*;
import com.itgaoshu.hospitalproject.mapper.DrugstoreMapper;
import com.itgaoshu.hospitalproject.service.DrugstoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DrugstoreServiceImpl implements DrugstoreService {
    @Autowired
    private DrugstoreMapper drugstoreMapper;
    public List<Drugstore> selectAllDrugstoreList(){
        return drugstoreMapper.selectAllDrugstoreList();
    }
    public int updateDrugstore(Drugstore drugstore){
        return drugstoreMapper.updateDrugstore(drugstore);
    }
    //查询药品类型
    public List <Type> seltype(Type type){
        return drugstoreMapper.seltype(type);
    }
    //查询药品类型
    public  List <Area> selarea(Area area){
        return drugstoreMapper.selarea(area);
    }
    //查询药品类型
    public  List <Unit> selunit(Unit unit){
        return drugstoreMapper.selunit(unit);
    }
    //经办人
    public   List <Skull> selskull(Skull skull){
        return drugstoreMapper.selskull(skull);
    }
    //供货商
    public  List <Upplier> selupplier(Upplier upplier){
        return drugstoreMapper.selupplier(upplier);
    }
    public List <Warehuose> selwarehuose(Warehuose warehuose){
        return drugstoreMapper.selwarehuose(warehuose);
    }
    public int insertrukudan(Caigou caigou){
        return drugstoreMapper.insertrukudan(caigou);
    }



    //修改药品信息
    public int updrugstore(Drugstore drugstore){
        return drugstoreMapper.updrugstore(drugstore);
    }

    //数量过少的药品查询
    public List<Drugstore> selectlackdrug(Drugstore drugstore){
        return drugstoreMapper.selectlackdrug(drugstore);
    }
    //库存不足的药品有多少条
    public  int selcountless(){
        return drugstoreMapper.selcountless();
    }
    //添加采购单
    public int addcaigou(Caigou caigou){
        return drugstoreMapper.addcaigou(caigou);
    }
    //添加采购单时判断采购单是否已经有同名药品
    public  int selcaigouname(Caigou caigou){
        return drugstoreMapper.addcaigou(caigou);
    }
    //添加采购单时如果已存在此药品 则直接加数量
    public  int upcaigounumber(Caigou caigou){
        return drugstoreMapper.selcaigouname(caigou);
    }

    //查询采购表单
    public  List<Caigou> selcaigou(Caigou caigou){
        return drugstoreMapper.selcaigou(caigou);
    }
    //删除采购单
    public  int delcaigou(Integer caigouid){
        return drugstoreMapper.delcaigou(caigouid);
    }
    //查询过期的药品
    public  List<Drugstore> seldrugDate(Drugstore drugstore){
        return drugstoreMapper.seldrugDate(drugstore);
    }
    //查询过期的药品有几条
    public  int selcountlessnum(){
        return drugstoreMapper.selcountlessnum();
    }
    //删除过期药品
    public   int delguoqidurg(Integer rugstoreId){
        return drugstoreMapper.delguoqidurg(rugstoreId);
    }

}
